# li=[11,23,33,44,55]
# print(li[1])
# dict={"name":"张三","age":18}
# print(dict["name"])

class MyClass:
    def __init__(self,a,b,c,d):
        self.a=a
        self.b=b
        self.c=c
        self.d=d
    def __getitem__(self, item):
        print("Item:",item)
        return getattr(self,item)

    def __setitem__(self, key, value):
        setattr(self,key,value)

    def __delitem__(self, key):
        print("删除索引：",key)
        delattr(self,key)

    def __len__(self):
        return len(self.__dict__)


m=MyClass(11,22,33,44)
print(m["d"])
m["abc"]=11111
print(m["abc"])
print(len(m))